<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:rich="http://richfaces.ajax4jsf.org/rich"
                template="layout.xhtml">

   <ui:define name="left">
      <h:form>
         <h2>Članki</h2>
         <h:dataTable value="#{allArticles}" var="article" styleClass="list">
            <h:column>
               <s:link action="#{contentManager.selectArticle}">#{article.title}</s:link>
            </h:column>
         </h:dataTable>
         <h2>Datoteke</h2>
         <h:dataTable value="#{allFiles}" var="file" styleClass="list">
            <h:column>
               <h:commandLink action="#{contentManager.selectFile(file)}">#{file.title}</h:commandLink>
            </h:column>
         </h:dataTable>
      </h:form>

   </ui:define>

   <ui:define name="body">
      <h:messages styleClass="message"/>
      <ui:include src="tags/article-display.xhtml">
         <ui:param name="article" value="#{displayedArticle}"/>
      </ui:include>
   </ui:define>

   <ui:define name="right">
      <h:form id="login" rendered="#{not identity.loggedIn}">
         <h2>Prijava</h2>
         <h:panelGrid columns="2" columnClasses="name,value">
            <h:outputLabel for="username">Uporabniško ime</h:outputLabel>
            <h:inputText id="username" value="#{identity.username}" />
            <h:outputLabel for="password">Geslo</h:outputLabel>
            <h:inputSecret id="password" value="#{identity.password}" />
         </h:panelGrid>

         <div class="actionButtons">
            <h:commandButton value="Login" action="#{identity.login}" />
         </div>
      </h:form>
      <s:div rendered="#{identity.loggedIn}" styleClass="userMenu">
         <h:outputText value="#{user.name} |"/>
         <s:link value="Logout" action="#{identity.logout}"/>
      </s:div>

   </ui:define>

   <ui:define name="foot">
      <s:link view="/ArticleList.xhtml" rendered="#{identity.hasRole('admin')}">Seam-gen</s:link>
   </ui:define>

</ui:composition>